//
//  SegmentedControl.h
//  mmbang
//
//  Created by 肖信波 on 13-8-31.
//  Copyright (c) 2013年 iyaya. All rights reserved.
//

#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, SegmentedControlType) {
    SegmentedControlTypeNormal = 0,
    SegmentedControlTypeTouch,
    SegmentedControlTypeYellow
};

typedef NS_ENUM(NSInteger, SegmentedControlShadowPosition) {
    SegmentedControlShadowPositionTop = 0,
    SegmentedControlShadowPositionBottom = 1,
    SegmentedControlShadowPositionNone = 2
};

@protocol SegmentedControlDelegate <NSObject>
@optional
- (void)selectBtnWithIndex:(NSInteger)index;
@end

@interface SegmentedControl : UIControl {
    NSMutableArray *_buttons;
    UIView *_flowView;
    NSMutableArray *_separatorViews;
    UIView *_shadowLine;
}

- (id)initWithTitles:(NSArray *)titles;

- (id)initWithTitles:(NSArray *)titles andVerSpace:(float)verSpace;

@property (nonatomic, strong) NSArray *titles;
@property (nonatomic, strong) NSMutableArray *buttons;
@property (nonatomic, strong) NSArray *icons;
@property (nonatomic, strong) NSArray *highlightIcons;
@property (nonatomic, strong) UIColor *titleColor;
@property (nonatomic, strong) UIFont *titleFont;
@property (nonatomic, assign) UIEdgeInsets titleInsets;
@property (nonatomic, assign) UIEdgeInsets imageInsets;
@property (nonatomic, strong) UIColor *selectedTitleColor;
@property (nonatomic, assign) BOOL selectedFlow;
@property (nonatomic, strong) UIView *flowView;
@property (nonatomic, assign) BOOL customFlowFrame;
@property (nonatomic, assign) CGRect customFlowRectInButton;
@property (nonatomic, assign) NSInteger selectedIndex;
@property (nonatomic, assign) BOOL separatorHidden;
@property (nonatomic, assign) SegmentedControlShadowPosition shadowPosition;
@property (nonatomic, weak) id <SegmentedControlDelegate> delgate;
@property (nonatomic, strong) UIColor *selectedFlowColor;

- (void)selectWithIndex:(NSInteger)index;
- (NSString *)getSelectedTitle;
- (void)dynamicSetIcons:(NSArray *)icons highlight:(NSArray *)highlightedIcons placeHolders:(NSArray *)placeHolders highlightedPlaceHolders:(NSArray *)highlightedPlaceHolders imageSize:(CGSize)imageSize;
- (void)upadateButtons:(NSArray*)titles andVerSpace:(NSNumber*)verSpace;

@end
